require "ImguiWin/BaseImguiWindow"
require "UnityEngine.SystemInfo"

local P = NewClass(BaseImguiWindow, ClassFromFile(...));

local GUILayout = UnityEngine.GUILayout
local GUI = UnityEngine.GUI
local Screen = UnityEngine.Screen

local showFields =
{
	"batteryLevel",
	"batteryStatus",
	"copyTextureSupport",
	"deviceModel",
	"deviceName",
	"deviceType",
	"deviceUniqueIdentifier",
	"graphicsDeviceID",
	"graphicsDeviceName",
	"graphicsDeviceType",
	"graphicsDeviceVendor",
	"graphicsDeviceVendorID",
	"graphicsDeviceVersion",
	"graphicsMemorySize",
	"graphicsMultiThreaded",
	"graphicsShaderLevel",
	"graphicsUVStartsAtTop",
	-- "hasDynamicUniformArrayIndexingInFragmentShaders",
	-- "hasHiddenSurfaceRemovalOnGPU",
	"maxCubemapSize",
	"maxTextureSize",
	"npotSupport",
	"operatingSystem",
	"operatingSystemFamily",
	"processorCount",
	"processorFrequency",
	"processorType",
	"supportedRenderTargetCount",
	"supports2DArrayTextures",
	-- "supports32bitsIndexBuffer",
	"supports3DRenderTextures",
	"supports3DTextures",
	"supportsAccelerometer",
	-- "supportsAsyncCompute",
	-- "supportsAsyncGPUReadback",
	"supportsAudio",
	"supportsComputeShaders",
	"supportsCubemapArrayTextures",
	-- "supportsGPUFence",
	"supportsGyroscope",
	-- "supportsHardwareQuadTopology",
	"supportsImageEffects",
	"supportsInstancing",
	"supportsLocationService",
	-- "supportsMipStreaming",
	"supportsMotionVectors",
	-- "supportsMultisampleAutoResolve",
	-- "supportsMultisampledTextures",
	"supportsRawShadowDepthSampling",
	"supportsRenderToCubemap",
	-- "supportsSeparatedRenderTargetsBlend",
	"supportsShadows",
	"supportsSparseTextures",
	-- "supportsTextureWrapMirrorOnce",
	"supportsVibration",
	"systemMemorySize",
	"unsupportedIdentifier",
	"usesReversedZBuffer",
}

local scrollPos = Vector2.zero

function P:OnGUI()
	GUIFun.Init()
	GUILayout.Box("", GUILayout.Height(Screen.height), GUILayout.Width(Screen.width))
	self:Show()
end

function P:Show()
	local space = 0
	GUILayout.BeginArea(self:GetFullScreenAreaRect())
	GUILayout.BeginVertical()

	scrollPos = GUILayout.BeginScrollView(scrollPos, false, true, GUILayout.Width(Screen.width));
	GUILayout.BeginVertical()
	for i = 1, #showFields do
		if GUIFun.Button(showFields[i]..": "..tostring(UnityEngine.SystemInfo[showFields[i]]), false, 0) then
			UniClipboard.SetText(tostring(UnityEngine.SystemInfo[showFields[i]]))
		end
	end
	GUILayout.EndVertical()
	GUILayout.EndScrollView()

	GUILayout.BeginHorizontal()
	if GUILayout.Button("close", GUIFun.Height(100)) then
		self._funObj:Close()
	end
	GUILayout.EndHorizontal()

	GUILayout.EndVertical()
	GUILayout.EndArea()
end
